local UIBase = require("view.UIBase")
local PopupItemTips = class("PopupItemTips", UIBase)
local TypeHelper = require("utils.TypeHelper")

function PopupItemTips:ctor(item)
    self._item = item
    local resource = {
        path = "Prefabs/Popup",
        name = "PopupItemTips",
        canvas = 3
    }
    PopupItemTips.super.ctor(self, resource)
end

function PopupItemTips:start()
    G_UIUtil.addTouchEvent(self._panelTouch, nil, nil, handler(self, self._onPanelClick))
    self._icon:updateUI(self._item.type, self._item.value)
    local itemParam = self._icon:getItemParam()
    self._textName.text = itemParam.name
    self._textDesc.text = itemParam.desc
end

function PopupItemTips:_onPanelClick()
    self:close()
end

return PopupItemTips
